package org.hope.web;

import org.hope.model.User;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by lisen on 2017/12/27.
 */
@RestController
public class UserBatchController {

    @RequestMapping(value = "/users", method = RequestMethod.GET)
    public List<User> batchUser(String ids) {
        System.out.println("ids===:" + ids);
        List<User> lists = new ArrayList<User>();
        lists.add(new User(1l, "小明"));
        lists.add(new User(2l, "小红"));
        lists.add(new User(3l, "小张"));
        lists.add(new User(4l, "小王"));
        lists.add(new User(5l, "小李"));

        return lists;
    }

    @RequestMapping(value = "/users/{id}", method = RequestMethod.GET)
    public User singleUser(@PathVariable("id") String id) {
        User user = new User(100L, "大王");
        return user;
    }

}
